package au.edu.swin.bank.ejb.session.stateless;

import au.edu.swin.bank.persistence.entity.BillDTO;
import java.math.BigInteger;
import java.util.Collection;
import javax.ejb.Remote;

/**
 *
 * @author root
 */
@Remote
public interface CustomerRemote
{
    /**
     * Logs in a user.
     * 
     * @param aUsername
     * @param aPassword
     * @return true if login successful, false otherwise
     */
    public boolean login(int aUsername, int aPassword);

    /**
     * Logs in a staff member.
     *
     * @param aUsername
     * @param aPassword
     *
     * @return true if login successful, false otherwise
     */
    public boolean staffLogin(int aUsername, int aPassword);

    /**
     * Logs in a customer.
     *
     * @param aUsername
     * @param aPassword
     *
     * @return true if login successful, false otherwise
     */
    public boolean customerLogin(int aUsername, int aPassword);

    /**
     * Gets the ID numbers of the accounts owned by a customer.
     *
     * @param custId
     *
     * @return the IDs of the customer's accounts
     */
    public Collection<BigInteger> getAccountIds(int custId);

    /**
     * Gets the bills linked to a customer.
     *
     * @param custId
     * @param onlyUnpaidBills if true, only unpaid bills are returned
     *
     * @return returns the bills linked to a customer
     */
    public Collection<BillDTO> getBills(int custId, boolean onlyUnpaidBills);

    /**
     * Opens a new account for a customer with the specified ID. If no customer
     * with the specified ID exists, a new customer with that ID will be created
     * along with its own bank account.
     *
     * @param aCustId
     *
     * @return true if the account opening was successful, false if otherwise
     */
    public boolean openAccount(int aCustId);

    /**
     * Closes an account with the specified ID.
     * 
     * @param aAccountId
     * 
     * @return true if the account closure was successful, false if otherwise
     */
    public boolean closeAccount(BigInteger aAccountId);

    /**
     * Checks whether a customer with the specified ID exists.
     *
     * @param custId
     *
     * @return true if the customer exists, false if otherwise
     */
    public boolean customerExists(int custId);

    /**
     * Forces an eviction of the data in the Bean's cache.
     */
    public void forceEvict();
}
